package serialize;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;

public class DeserializationTest3 {

	public static void main(String[] args) throws IOException , ClassNotFoundException {
		
		File f = new File( "human.ser" );
		InputStream in = new FileInputStream( f );
		ObjectInput oi = new ObjectInputStream(in);
		
		Object o = oi.readObject(); // 读取一个对象
		
		if( o instanceof Human ) {
			Human h = (Human) o ;
			System.out.println( h.getId() );
			System.out.println( h.getName() );
			System.out.println( h.getGender() );
			System.out.println( h.getBirthdate() );
		}
		
		oi.close();
		in.close();

	}

}
